//
//  DTAlert.m
//  Objective-cDemo
//
//  Created by ShareAnimation on 2019/8/7.
//  Copyright © 2019 爱丽丝的梦境. All rights reserved.
//

#import "DTAlert.h"
#import "LEEAlert.h"
#import <objc/runtime.h>
static NSString *const kRedPaperAlertAssociatedKey = @"kRedPaperAlertAssociatedKey";
@implementation DTAlert
+ (void)alertWithClickAction:(void(^)(void))block {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 500)];
    view.backgroundColor = [UIColor redColor];
    
    UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 50)];
    myButton.backgroundColor = [UIColor yellowColor];
    [view addSubview:myButton];
    [myButton addTarget:self action:@selector(doButtonAction) forControlEvents:UIControlEventTouchUpInside];
    
    objc_setAssociatedObject(view, &kRedPaperAlertAssociatedKey, block, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    
    [LEEAlert alert].config
    .LeeCustomView(view)
    .LeeHeaderInsets(UIEdgeInsetsMake(0, 0, 0, 0))
    .LeeHeaderColor([UIColor clearColor])
    .LeeBackGroundColor([UIColor colorWithWhite:0.8 alpha:1])
    .LeeBackgroundStyleTranslucent(0.7)
    .LeeShow();
}

- (void)doButtonAction {
    NSLog(@"2222");
}
@end
